﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace caDownAsyncDemo
{
    class caDownAsync
    {
        static void Main(string[] args)
        {

            #region 异步访问页面Demo
            System.Net.WebClient wc = new System.Net.WebClient();
            wc.DownloadStringCompleted += (object sender, System.Net.DownloadStringCompletedEventArgs e) =>
            {
                Console.WriteLine("下载数据完成。。。。。\n");
                Console.WriteLine(e.Result);
            };
            Console.WriteLine("开始下载数据。。。。\n");
            wc.DownloadStringAsync(new Uri("http://www.baidu.com"));

            Console.WriteLine("Exiting。。。\n"); 
            #endregion

            Console.ReadKey();
        }
    }
}
